package com.sinven.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sinven.mapper.PictureMapper;
import com.sinven.pojo.Picture;
@Service
public class PictureServiceImpl implements PictureService{
	//�Զ�װ��
	@Autowired
		private PictureMapper pictureMapper;
	//��д
	@Override
	/**
	 * ����ͼƬ
	 */
	public Picture addPicture(Picture picture) throws Exception {
		int count = pictureMapper.addPicture(picture);
		System.out.println(picture);
		if (count > 0) {
			return picture;
		} else {
			return null;
		}
	}

	@Override
	/**
	 * ɾ��ͼƬ
	 */
	public boolean deletePicture(int p_id) throws Exception {
		int count= pictureMapper.deletePicture(p_id);
		if(count>0) {
			return true;
		}
		return false;
	}

	@Override
	/**
	 * �޸�ͼƬ
	 */
	public boolean updatePicture(Picture picture) throws Exception {
		int count = pictureMapper.updatePicture(picture);
		if(count>0) {
			return true;
		}
		return false;
	}

	@Override
	/**
	 * ��ѯ����ͼƬ
	 */
	public Picture selectPictureAll(int p_id) throws Exception {
		Picture picture=pictureMapper.selectPictureAll(p_id);
		if(picture==null) {
			return null; 
		}
		return picture;
	}

}
